/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Scenery.Thing.Things;

import Scenery.Thing.Thing;
import com.jme3.bullet.collision.shapes.BoxCollisionShape;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.light.AmbientLight;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import main.Memory.Memory;

/**
 *
 * @author usuario
 * 
 */

public class Sign extends Thing {
    
    public Sign(float size, float x, float y, float z) {
        buildParts(size, x, y , z);
    }
    
    private Geometry box;
    private Geometry post;
    private int signId;
    
    protected void buildParts(float size, float x, float y, float z) {
        Box b = new Box(0.1f,0.6f,0.8f);
        Box p = new Box(0.1f,0.5f,0.1f);
        
       int signId2 = Memory.getNexSignId();
       this.signId = signId2;
       Memory.getSigns().put(signId, null); // no text yet
        
        post = new Geometry("Post",p);
        box = new Geometry("Sign:"+signId, b);
        
        post.setMaterial(Memory.getTextures().getMaterial("box", "flat"));
        post.setLocalTranslation(x+size+(1f-size), y+(size), z-size-(1f-size));
        post.addControl(getRigidBodyControl());
        box.setMaterial(Memory.getTextures().getMaterial("box", "flat"));
        box.setLocalTranslation(x+size+(1f-size), y+(size)+1f, z-size-(1f-size));
        box.addControl(getRigidBodyControl());
        //box.getControl(RigidBodyControl.class).setRestitution(1);
        //box.getControl(RigidBodyControl.class).setFriction(0.2f);
        //box.getControl(RigidBodyControl.class).setMass(0.1f);
        masterNode.attachChild(box);
        masterNode.attachChild(post);
    }
    
    public Geometry getBox() { 
        return box; 
    }

    @Override
    protected RigidBodyControl getRigidBodyControl() {
        return new RigidBodyControl(00f) ;
    }

    @Override
    public Geometry getCollidable() {
        return box;
    }
  
    
}
